﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DnPakExplorer.Controls {
	public partial class IconCtrl : UserControl {

		private int mIconId = -1;

		[Browsable(false)]
		public int IconId {
			get { return mIconId; }
			set {
				if (mIconId != value) {
					Invalidate();
				}
				mIconId = value;
			}
		}

		public IconType IconType { get; set; }

		public IconCtrl() {
			InitializeComponent();
		}

		private void IconCtrl_Paint(object sender, PaintEventArgs e) {
			if (IconId >= 0) {
				switch (IconType) {
				case IconType.Item:
					Util.DrawItemImage(IconId, ClientRectangle, e.Graphics);
					break;
				case IconType.Skill:
					Util.DrawSkillImage(IconId, ClientRectangle, e.Graphics);
					break;
				}
				
			}
		}
	}

	public enum IconType{
		Item, Skill
	}
}
